<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@include file="/view/common/header-talent.jspf" %>
	
		<center><h1>求职个人中心</h1></center>
		<hr>
		
		<h3>一、简历管理</h3>
		<a href="<%=request.getContextPath() %>/view/talent/resume-add.jsp">新增简历</a>
		<table  class="table table-hover">
				<tr>
					<th>序号</th>
					<th>求职意向</th>
					<th>操作</th>
				</tr>
			<c:forEach items="${resumeList }" var="resume" varStatus="v">
				<tr>
					<td>${v.count }</td>
					<td><a href="<%=request.getContextPath() %>/ResumeServlet?command=preUpdate&resumeId=${resume.id }">${resume.intention }</a></td>
					<td><a href="<%=request.getContextPath() %>/ResumeServlet?command=preUpdate&resumeId=${resume.id }">修改</a> | <a href="javascript:deleteResume(${resume.id });">删除</a></td>
				</tr>
			</c:forEach>
		</table>
		
		<h3>二、结果查询</h3>
		<table  class="table table-hover">
			<tr>
				<th>序号</th>
				<th>职位名称</th>
				<th>所属企业</th>
				<th>申请状态</th>
				<th>申请时间</th>
				<th>操作</th>
			</tr>
			<c:forEach items="${pageModel.list }" var="application" varStatus="v">
			<tr>
				<td>${(pageModel.pageNo - 1) * pageModel.pageSize + v.count}</td>
				<td>${application.positionName }</td>
				<td>${application.companyName }</td>
				<td>${application.statusStr }</td>
				<td><fmt:formatDate value="${application.appTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><a href="javascript:deleteApplication(${application.id })">删除</a></td>
			</tr>
			</c:forEach>
			<tr>
				<td colspan="6" align="right">
				<a href="javascript:go2('<%=request.getContextPath()%>/TalentServlet?command=main&pageNo=1&pageSize=')">首页</a>
				<c:if test="${pageModel.pageNo > 1 }">
					<a href="javascript:go2('<%=request.getContextPath()%>/TalentServlet?command=main&pageNo=${pageModel.pageNo - 1 }&pageSize=')">上一页</a>
				</c:if>
				<c:if test="${pageModel.pageNo < pageModel.totalPages }">
					<a href="javascript:go2('<%=request.getContextPath()%>/TalentServlet?command=main&pageNo=${pageModel.pageNo + 1 }&pageSize=')">下一页</a>
				</c:if>
				<a href="javascript:go2('<%=request.getContextPath()%>/TalentServlet?command=main&pageNo=${pageModel.totalPages }&pageSize=')">尾页</a>
				<select id="pageNo" onchange="go()">
					<script>
						for (var i = 1; i <= '${pageModel.totalPages}'; i++) {
							if ('${pageModel.pageNo}' == i) {
								document.write('<option value=' + i + ' selected="selected">' + i + '</option>');
							} else {
								document.write('<option value=' + i + '>' + i + '</option>');
							}
						}
					</script>
				</select>
				，每页显示
				<select id="pageSize">
					<script>
						var arrays = [10, 30, 50, 100];
						for (var i = 0; i < arrays.length; i++) {
							if ('${pageModel.pageSize}' == arrays[i]) {
								document.write('<option value="' + arrays[i] + '" selected="selected">' + arrays[i] + '</option>');
							} else {
								document.write('<option value="' + arrays[i] + '">' + arrays[i] + '</option>');
							}
						}
					</script>
				</select>条，
				共${pageModel.totalRecords }条记录。</td>
			</tr>
		</table>
		
		<script>
			function deleteResume(resumeId) {
				layer.confirm('确认删除？', {
				    btn: ['确认','取消'] //按钮
				}, function(){
				   location = '<%=request.getContextPath()%>/ResumeServlet?command=deleteResume&resumeId=' + resumeId;
				});
			}
			
			function deleteApplication(applicationId) {
				layer.confirm('确认删除？', {
				    btn: ['确认','取消'] //按钮
				}, function(){
				   location = '<%=request.getContextPath()%>/ApplicationServlet?command=deleteApplication&applicationId=' + applicationId;
				});
			}
			
			function go() {
				var pageNo = document.getElementById('pageNo').value;
				var pageSize = document.getElementById('pageSize').value;
				location = '<%=request.getContextPath()%>/TalentServlet?command=main&pageNo=' + pageNo + '&pageSize=' + pageSize;
			}
			
			function go2(url) {
				var pageSize = document.getElementById('pageSize').value;
				location = url + pageSize;
			}
		</script>
	</body>
</html>